package cn.zz.veggie.web.types.dto.mgmt;

import cn.zz.comm.util.NumberUtil;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Positive;
import jakarta.validation.constraints.PositiveOrZero;
import lombok.Getter;
import lombok.Setter;

/**
 * @author zhongq
 * @since 2024/4/25
 */
@Getter
@Setter
public class MgmtCategoryDto {

	@Positive
	private Integer id;
	@NotNull
	@NotBlank
	private String name;

	@PositiveOrZero
	private Integer pid;
	@Positive
	private Integer sort;
	@NotNull
	@Min(0)
	@Max(1)
	private Integer status;

	public void requireValid() {
		this.pid = NumberUtil.nullToZero(pid);

	}
}